package com.team.mp.api.service.impl;


import com.team.mp.api.service.intf.DocterTeamService;
import com.team.mp.mapper.dao.DocterTeamDao;
import com.team.mp.mapper.entity.DocterTeam;
import com.team.mp.vo.R;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * 千锋郑州Java学科欢迎你
 * @program: Tproject
 * @description: 业务接口实现层
 * @author: xiaopi
 * @create: 2023-03-27 11:47:49
 */
@Service
public class DocterTeamServiceImpl implements DocterTeamService {
    /**
    *注入持久层对象*/
    @Resource
    private DocterTeamDao dao;

    /**
    * 新增内容*/
    @Override
    public R save(DocterTeam docterTeam) {
        if(docterTeam !=null){
            int i=dao.insert(docterTeam);
            if(i>0){
                return R.ok();
            }
        }
        return R.fail("亲，新增异常！");
    }
    /**
    * 修改内容*/
    @Override
    public R update(DocterTeam docterTeam) {
        if(docterTeam !=null){
            int i=dao.updateById(docterTeam);
             if(i>0){
                return R.ok();
              }
        }
        return R.fail("亲，修改异常！");
    }
    /**
    *删除 */
    @Override
    public R del(long id){
        if(id>0){
            int i=dao.deleteById(id);
            if(i>0){
                return R.ok();
            }
        }
        return R.fail("删除异常");
    }

    /**
    * 查询详情*/
    @Override
    public R queryById(long id){
        return R.ok(dao.selectById(id));
    }

    /**
    * 查询 所有数据*/
    @Override
    public R queryAll() {
      return R.ok(dao.selectList(null));
    }
}
